package com.ftm.service.impl;

import java.util.List;

/**
 * @author 成子
 */
import com.ftm.dao.AdminDao;
import com.ftm.dao.impl.AdminDaoImpl;
import com.ftm.entity.Admin;
import com.ftm.service.AdminService;

public class AdminServiceImpl implements AdminService {
	AdminDao ad = new AdminDaoImpl();

	// 判断帐号密码
	@Override
	public boolean DetermineAdmin(String user, String pwd) {
		Admin admin = ad.queryAdmin(user, pwd);
		if (admin == null) {
			return false;
		}
		return true;
	}

	// 删除管理员操作
	@Override
	public boolean DelAdmin(String name) {
		boolean f = ad.delAdmin(name);
		if (f) {
			return true;
		}
		return false;
	}

	// 查询某一管理员
	@Override
	public Admin queryoneAdmin(String user) {
		List<Admin> list = ad.getAdmin(user);
		if (list.size() == 0) {
			return null;
		}
		return list.get(0);
	}
	// 修改密码
	@Override
	public boolean UpdateAdminpwd(String user, String pwd) {
		boolean f=ad.UpdataPwd(user, pwd);
		if(f) {
			return true;
		}
		return false;
	}

}
